﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using KMFrame.Permission.Util;
using LGCourt.Logic.BLL;
using LGCourt.Logic.NBL.DBEntities;

namespace lgweb.user
{
    public partial class aflterqa : System.Web.UI.Page
    {
        private string _AH = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!SessionBox.CheckUserSession())
            {
                Response.Redirect("/user/login.aspx");
            }
            GetParam();
            if (!this.IsPostBack)
            {
               
                GetList();
            }
        }

        private void GetParam()
        {
            this._AH = string.IsNullOrEmpty(Request.QueryString["ah"]) ? "" : Request.QueryString["ah"];
            if (string.IsNullOrEmpty(this._AH))
            {
                Response.Redirect("/user/index.aspx");
            }
            this.hdnAH.Value = this._AH;
            this.spAH.InnerHtml = this._AH;
        }

        private void GetList()
        {
             CaseInfo bll = new CaseInfo();

            int _userID = SessionBox.GetUserSession().UserID;
            UserCondition param = new UserCondition();
            param.AH = this._AH;
            param.UserID = _userID;

            CaseALLInfo result = (CaseALLInfo)bll.GetCaseALLInfo(param);

            if (result != null)
            {
                this.rptPHDY.DataSource = result.PHDYList;
                this.rptPHDY.DataBind();
            }
        }

        //新增判后答疑
        protected void Button1_Click(object sender, EventArgs e)
        {
            CaseInfo bll = new CaseInfo();

            pPHDY param = new pPHDY();
            param.AH = this._AH;
            param.WDR = SessionBox.GetUserSession().UserName;
            param.NR = this.txtNR.Value;

            bool result = (bool)bll.AddPHDY(param);

            if (result)
            {
                this.tdMessages.InnerHtml = "添加成功！";
                GetList();
            }
            else
            {
                this.tdMessages.InnerHtml = "添加失败！";
            }
        }
    }
}